package com.charging.business.vo.obj;

import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * @author JerryLu
 * @date 2024/9/26 17:44
 * @description 出口min分省金额列表
 */
public class SplitProvinceMini {
    /**
     * 省份编码
     * 必填：是
     */
    @JSONField(ordinal = 0)
    public Integer provinceId = 0;

    /**
     * 最小费额实收金额
     * 必填：是
     */
    @JSONField(ordinal = 1)
    public Integer calMinFeeFee = 0;

    /**
     * 最小费额95折实收金额
     * 必填：是
     */
    @JSONField(ordinal = 2)
    public Integer calMinFeeFee95 = 0;

    /**
     * 最小费额里程
     * 必填：否
     */
    @JSONField(ordinal = 3)
    public Integer calMinFeeMileage = 0;

    /**
     * 计费收费单元数量
     * 必填：是
     */
    @JSONField(ordinal = 4)
    public Integer tollIntervalsCount = 0;

    /**
     * 计费收费单元编号组合
     * 使用“ | ”分隔
     * 必填：是
     */
    @JSONField(ordinal = 5)
    public String tollIntervalsGroup = "";

    /**
     * 计费收费单元实收金额组合
     * 单位：分。使用“ | ”分隔
     * 必填：是
     */
    @JSONField(ordinal = 6)
    public String feeGroup = "";

    /**
     * 计费模块和计费参数版本号
     * 不超过40个字符，计费模块和计费参数版本号使用“|”分隔
     * 必填：未定
     */
    @JSONField(ordinal = 7)
    public String rateVersion = "";

    /**
     * 自定义字段
     * 兜底应收金额
     * 必填：是
     * MTC - 为优惠前的calMinFeeFee金额
     * ETC - 为优惠前的calMinFeeFee95金额
     */
    @JSONField(ordinal = 8, serialize = false, deserialize = false)
    public Integer ziMinPayFee = 0;

    /**
     * 自定义字段
     * 兜底实收金额
     * 必填：是
     * MTC - 为优惠后的calMinFeeFee金额
     * ETC - 为优惠后的calMinFeeFee95金额
     */
    @JSONField(ordinal = 9, serialize = false, deserialize = false)
    public Integer ziMinFee = 0;

    @JSONField(serialize = false, deserialize = false)
    public void toFree() {
        ziMinFee = 0;
        calMinFeeFee = 0;
        calMinFeeFee95 = 0;

        if (tollIntervalsCount > 0) {
            feeGroup = "";
            String[] tollIntervals = tollIntervalsGroup.split("\\|");
            for (int aa = 0; aa < tollIntervals.length; aa++) {
                if (feeGroup.length() > 0) {
                    feeGroup += "|";
                }
                feeGroup += "0";
            }
        }
    }
}
